import org.aopalliance.intercept.MethodInvocation;

public class InterceptorAspect implements MethodInterceptor {
	@Override
	public Object invoke(MethodInvocation methodInvocation) throws Throwable {
		long start = System.currentTimeMillis();
		try {
			Object result = methodInvocation.proceed();
			return result;
		}
		finally {
			long end = System.currentTimeMillis();
			long timeMs = end - start;
			System.out.println("Method: " + methodInvocation.toString() + " took: " + timeMs +"ms.");
		}
	}
}
